import * as type from "./type"
import axios from "utils/http"
import { createGunzip } from "zlib";
let actions = {
    [type.ProductList]({commit,rootState},{goodsId}){

        axios({
            method: "get",
            url: "/product/getWapGoodsDetailDynamic.json",
            params: {
                t: new Date().getTime(),
                goodsId: goodsId,
            }
        }).then(res => {  
            // console.log("ProductList数据请求",res.data);
            let action = {
                type: type.ProductList,
                payload: res.data
            }

                commit(action);     
          
        })
        .catch(err => {
           return err;
            
        })
   
    },
    [type.ProductTitle]({commit,rootState},{goodsId}){

        axios({
            method: "get",
            url: "/product/getGoodsAttachment.json",
            params: {
                t: new Date().getTime(),
                goodsId: goodsId,
            }
        }).then(res => {  
            // console.log("ProductTitle数据请求",res.data);
            let action = {
                type: type.ProductTitle,
                payload: res.data
            } 
        
                commit(action);     
          
        })
        .catch(err => {
           return err;
            
        })
   
    }

}

export default actions;
